import { IRegisterInfo, IUser } from '@src/types/account';
import request from './index';
import { sha256 } from '@src/utils/security';

// 获取直播间或者直播信息
export default function createAccount(
  userInfo: IRegisterInfo,
): Promise<{ uid: IUser['uid'] }> {
  // 密码使用sha265进行加密
  const data = {
    ...userInfo,
    password: sha256(userInfo.password),
  };
  return request({
    method: 'post',
    url: '/account/register',
    data: data,
  });
}
